﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SwissTransTracker
{
    /// <summary>
    ///     See transport.opendata.ch
    /// </summary>
    public class Stationboard
    {
        /// <summary>
        ///     The station of who's stationboard this is
        /// </summary>
        public Location Station { get; set; }

        /// <summary>
        ///     All the transports who stop here
        /// </summary>
        public List<TransportStop> StationBoard { get; set; }

        public override string ToString()
        {
            var sb = new StringBuilder();
            if (this.Station != null)
                sb.AppendFormat("\tStation: {0}\t\t{1}", Environment.NewLine,
                                this.Station.ToString().Replace(Environment.NewLine, Environment.NewLine + "\t\t"));

            sb.AppendLine();
            if (this.StationBoard != null)
            {
                sb.AppendFormat("\tStationBoard: {0}", Environment.NewLine);
                foreach (var transportStop in StationBoard)
                {
                    sb.AppendFormat("\t\t{0}{1}", transportStop.ToString().Replace(Environment.NewLine,Environment.NewLine+"\t\t"), Environment.NewLine);
                    sb.AppendLine();
                }
            }

            return sb.ToString();
        }
    }
}